package com.niit.scs.server.service;

import com.niit.scs.server.doc.EsContentInfo;
import com.niit.scs.server.domain.ContentInfo;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import javax.swing.text.AbstractDocument;
import java.util.List;
import java.util.Optional;

/**
 * Service Interface for managing {@link ContentInfo}.
 */
public interface ContentInfoService {

    /**
     * Save a contentInfo.
     *
     * @param contentInfo the entity to save.
     * @return the persisted entity.
     */
    ContentInfo save(String login,ContentInfo contentInfo);

    /**
     * Get all the contentInfos.
     *
     * @param pageable the pagination information.
     * @return the list of entities.
     */
    Page<ContentInfo> findAll(Pageable pageable);


    /**
     * Get the "id" contentInfo.
     *
     * @param id the id of the entity.
     * @return the entity.
     */
    Optional<ContentInfo> findOne(Long id);

    /**
     * Delete the "id" contentInfo.
     *
     * @param id the id of the entity.
     */
    void delete(String login,Long id) throws Exception;

    Page<ContentInfo> getContentByTypeName(String typeName,Integer index,Integer size);
    Page<ContentInfo> getAllContent(String keyword,String typeName,Integer index,Integer size);

    Page<ContentInfo> getSubContent(String login,String keywords,Integer index,Integer size);

    Page<ContentInfo> myPraise(String login,Integer index,Integer size);
    Page<ContentInfo> myFavorite(String login,Integer index,Integer size);

    Page<ContentInfo> myContent(String login,Integer index,Integer size);

    Page<EsContentInfo> getContentFromEs(String text,Integer index,Integer size);

    /**
     * 更新ES中每条记录的坐标字段
     * @return
     */
    List<EsContentInfo> updateContentPosition();
}
